Skip to content

Remove pyre-fixme/pyre-ignore from ax/service, ax/storage, ax/utils test files#4990

Closed
saitcakmak wants to merge 3 commits into
facebook:mainfrom
saitcakmak:export-D95273568
Closed

Remove pyre-fixme/pyre-ignore from ax/service, ax/storage, ax/utils test files#4990
saitcakmak wants to merge 3 commits into
facebook:mainfrom
saitcakmak:export-D95273568

Conversation

@saitcakmak
Copy link
Copy Markdown
Contributor

Summary:
Remove pyre-fixme and pyre-ignore type suppression comments from test files in
ax/service/tests, ax/storage//tests, and ax/utils//tests. Uses proper type narrowing
via none_throws, assert_is_instance, cast, and explicit type annotations instead of
suppression comments.

Differential Revision: D95273568

Summary:
Remove ~124 pyre-fixme/pyre-ignore suppression comments from 22 source files
in ax/storage/ by applying proper type fixes:

- Use `cast(type[SQAClass], ...)` for SQA class lookups from config dicts
- Use `cast(type[Enum], enum)` for enum value/name access
- Change bare `type` to `type[Any]` in registry function signatures
- Use `assert_is_instance()` for JSON dict key narrowing
- Add proper type annotations for Generator return types
- Use `none_throws()` for generation strategy ID access
- Fix SQLAlchemy TypeDecorator parameter types

Remaining pyre errors are pre-existing SQLAlchemy/BoTorch stub mismatches
that cannot be fixed without changing library type stubs.

Differential Revision: D95264795
… test files

Summary:
Remove pyre-fixme and pyre-ignore type suppression comments from test files in
ax/core/tests, ax/adapter/tests, ax/adapter/transforms/tests, and source file
ax/adapter/transforms/one_hot.py. Uses proper type narrowing via none_throws,
assert_is_instance, cast, and explicit type annotations instead of suppression
comments.

Key changes:
- Replace `# pyre-ignore[16]` on `Parameter` attribute access with
  `assert_is_instance(..., RangeParameter)` / `ChoiceParameter` / `FixedParameter`
- Replace `# pyre-fixme[16]` on Optional access with `none_throws(...)`
- Add explicit type annotations (`TParameterization`, `TConfig`, `list[float]`,
  `dict[str, float | int]`) to fix type inference issues
- Replace `**attrs` dict unpacking with explicit kwargs to eliminate union-type
  pyre errors in test_observation.py
- Fix `all()` generator expression scoping bug in test_batch_trial.py (missing
  parentheses caused pyre-fixme[6])
- Remove unnecessary `return` statements inside `assertRaises` blocks
- Add missing return type and parameter annotations on mock-decorated test methods
- Refactor BoTorchGenerator construction in test_cross_validation.py to avoid
  pyre-ignore on `adapter.generator.surrogate` access

Differential Revision: D95273495
@meta-cla meta-cla Bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Mar 6, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 6, 2026

@saitcakmak has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95273568.

saitcakmak added a commit to saitcakmak/Ax that referenced this pull request Mar 6, 2026
…est files (facebook#4990)

Summary:
Pull Request resolved: facebook#4990

Remove pyre-fixme and pyre-ignore type suppression comments from test files in
ax/service/tests, ax/storage/*/tests, and ax/utils/*/tests. Uses proper type narrowing
via none_throws, assert_is_instance, cast, and explicit type annotations instead of
suppression comments.

Differential Revision: D95273568
saitcakmak added a commit to saitcakmak/Ax that referenced this pull request Mar 6, 2026
…est files (facebook#4990)

Summary:
Pull Request resolved: facebook#4990

Remove pyre-fixme and pyre-ignore type suppression comments from test files in
ax/service/tests, ax/storage/*/tests, and ax/utils/*/tests. Uses proper type narrowing
via none_throws, assert_is_instance, cast, and explicit type annotations instead of
suppression comments.

Differential Revision: D95273568
…est files (facebook#4990)

Summary:
Pull Request resolved: facebook#4990

Remove pyre-fixme and pyre-ignore type suppression comments from test files in
ax/service/tests, ax/storage/*/tests, and ax/utils/*/tests. Uses proper type narrowing
via none_throws, assert_is_instance, cast, and explicit type annotations instead of
suppression comments.

Differential Revision: D95273568
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.84615% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.84%. Comparing base (a89122d) to head (7bf020e).

Files with missing lines Patch % Lines
ax/storage/json_store/encoders.py 80.00% 1 Missing ⚠️
ax/storage/sqa_store/load.py 75.00% 1 Missing ⚠️
ax/utils/common/tests/test_docutils.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4990   +/-   ##
=======================================
  Coverage   96.83%   96.84%           
=======================================
  Files         601      601           
  Lines       64662    64717   +55     
=======================================
+ Hits        62616    62673   +57     
+ Misses       2046     2044    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 6, 2026

This pull request has been merged in 9a79809.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants